API Documentation
ListBox.h
1 // ListBox.h
3 //
5 
6 namespace nkWinUi
7 {
11  class DLL_WINUI_EXPORT ListBox : public Component
12  {
13  public :
14 
18  class DLL_WINUI_EXPORT Item
19  {
20  public :
21 
25  Item () ;
29  ~Item () ;
30 
31  // Getters
35  ListBox* getParentList () const ;
43  void* getAttachedData () const ;
44 
45  // Setters
51  void setParentList (ListBox* parent) ;
57  void setLabel (const nkMemory::StringView& label) ;
65  void setAttachedData (void* data) ;
66  } ;
67 
68  public :
69 
73  ListBox () ;
77  ~ListBox () ;
78 
79  // Getters
84  Item* getItemFromLabel (const nkMemory::StringView& label) const ;
89  Item* getItemFromData (void* data) const ;
94  Item* getItemFromIndex (unsigned int index) const ;
98  virtual Item* getCurrentSelection () const ;
102  virtual int getCurrentSelectionIndex () const ;
110  unsigned int getItemCount () const ;
111 
112  // Setters
119 
129  virtual Item* insertItem (const nkMemory::StringView& text, void* data) ;
135  virtual void* deleteItem (const nkMemory::StringView& name) ;
142  virtual void changeItemLabel (const nkMemory::StringView& oldText, const nkMemory::StringView& newText) ;
151  void changeItemData (const nkMemory::StringView& text, void* newData) ;
158  virtual bool setSelected (const nkMemory::StringView& text) ;
165  virtual bool setSelectedIndex (unsigned int index) ;
172  bool setSelectedData (void* data) ;
176  virtual void clearItems () ;
177 
181  virtual void exportIntrospection (nkExport::Node* rootNode) override ;
185  virtual void importClassFromTree (nkExport::Node* rootNode) override ;
186  } ;
187 }
nkWinUi::ListBox::Item::~Item
~Item()
nkWinUi::ListBox::Item::setAttachedData
void setAttachedData(void *data)
nkWinUi::ListBox::ListBox
ListBox()
nkWinUi::ListBox::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkWinUi::ListBox::getItemCount
unsigned int getItemCount() const
nkWinUi::ListBox::getCurrentSelection
virtual Item * getCurrentSelection() const
nkWinUi::ListBox::setSelectionSpecializedCallback
void setSelectionSpecializedCallback(listBoxSelectionCallback value)
nkWinUi::ListBox
A graphical list box.
Definition: ListBox.h:12
nkWinUi::ListBox::getItemFromIndex
Item * getItemFromIndex(unsigned int index) const
nkWinUi::ListBox::deleteItem
virtual void * deleteItem(const nkMemory::StringView &name)
nkWinUi::ListBox::Item::Item
Item()
nkWinUi::ListBox::setSelectedIndex
virtual bool setSelectedIndex(unsigned int index)
nkWinUi::ListBox::getSelectionSpecializedCallback
listBoxSelectionCallback getSelectionSpecializedCallback() const
nkWinUi::ListBox::setSelectedData
bool setSelectedData(void *data)
nkWinUi::ListBox::Item
Definition: ListBox.h:19
nkWinUi::ListBox::exportIntrospection
virtual void exportIntrospection(nkExport::Node *rootNode) override
nkWinUi::ListBox::getItemFromLabel
Item * getItemFromLabel(const nkMemory::StringView &label) const
nkWinUi::ListBox::changeItemLabel
virtual void changeItemLabel(const nkMemory::StringView &oldText, const nkMemory::StringView &newText)
nkWinUi::Component
Base class for any graphical component.
Definition: Component.h:12
nkWinUi::ListBox::setSelected
virtual bool setSelected(const nkMemory::StringView &text)
nkWinUi::ListBox::Item::getParentList
ListBox * getParentList() const
nkWinUi::ListBox::Item::setLabel
void setLabel(const nkMemory::StringView &label)
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkWinUi::ListBox::insertItem
virtual Item * insertItem(const nkMemory::StringView &text, void *data)
nkWinUi::ListBox::~ListBox
~ListBox()
nkWinUi::ListBox::Item::getLabel
nkMemory::StringView getLabel() const
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkWinUi::ListBox::clearItems
virtual void clearItems()
nkWinUi::ListBox::getCurrentSelectionIndex
virtual int getCurrentSelectionIndex() const
nkWinUi::ListBox::Item::setParentList
void setParentList(ListBox *parent)
nkWinUi::listBoxSelectionCallback
std::function< bool(ListBox *caller)> listBoxSelectionCallback
Used by a nkWinUi::ListBox to signal a selection occurred inside.
Definition: CallbackRepository.h:103
nkWinUi::ListBox::Item::getAttachedData
void * getAttachedData() const
nkWinUi::ListBox::changeItemData
void changeItemData(const nkMemory::StringView &text, void *newData)
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Button.h:7
nkWinUi::ListBox::getItemFromData
Item * getItemFromData(void *data) const